
var currentUrl="";//当前列表后台数据访问地址
var heanData;//当前显示列表 头
var exportNames=["内检测MARK信息表","内检测弯头信息表","内检测阀门信息表","内检测环焊缝信息表","内检测三通信息表","内检测外部支撑信息表","内检测偏心套管信息表","内检测金属外接物信息表","内检测修补壳层信息表","内检测其它特征信息表"];

var headdata=[[{id:"PPLNAME",name:'管道名称',className:'nname',headstyle:'width:16.6%'},/*MARK*/
	//{id:"PPSNAME",name:'管段名称',className:'nname'},
	{id:"CUSTOM_NUMBER",name:'MARK检测编号',headstyle:'width:16.6%'},
	{id:"MILEAGE",name:'绝对距离(m)',headstyle:'width:16.6%'},
	{id:"REFERENCE",name:'最近参考点',headstyle:'width:16.6%'},
	{id:"REFERENCE_DISTANCE",name:'相对最近参考点距离(m) ',headstyle:'width:16.6%'},
	{id:'1',name:'详情',className:'xq-icon2',headstyle:'width:16.6%'},
	{id:"PPLNAME",name:'管道名称',className:'nname'},/*MARK*/
	//{id:"PPSNAME",name:'管段名称',className:'nname'},
	{id:"CUSTOM_NUMBER",name:'MARK检测编号'},
	{id:"MILEAGE",name:'绝对距离(m)'},
	{id:"REFERENCE",name:'最近参考点'},
	{id:"REFERENCE_DISTANCE",name:'相对最近参考点距离(m)'},
	{id:"RECORDER",name:'记录人'},
	{id:"RECORDTIME",name:'记录时间'},
	{id:"CREATE_REMARK",name:'备注'},
	{id:"LOCATION_DESCRIPTION",name:'位置描述'}
],

	[{id:"PPLNAME",name:'管道名称',className:'nname',headstyle:'width:14.28%'},/*弯头*/
		//{id:"PPSNAME",name:'管段名称',className:'nname'},
		{id:"MILEAGE",name:'绝对距离(m)',headstyle:'width:14.28%'},
		{id:"INSP_NUMBER",name:'弯头检测编号',headstyle:'width:14.28%'},
		{id:"ELBOW_TYPE",name:'弯头类型',headstyle:'width:14.28%'},
		{id:"ELBOW_ANGLE",name:'弯头角度（°）',headstyle:'width:14.28%'},
		{id:"ELBOW_CURVRAD",name:'曲率半径（D）',headstyle:'width:14.28%'},
		{id:'1',name:'详情',className:'xq-icon2',headstyle:'width:14.28%'},
		{id:"PPLNAME",name:'管道名称',className:'nname'},
		//{id:"PPSNAME",name:'管段名称',className:'nname'},
		{id:"MILEAGE",name:'绝对距离(m)'},
		{id:"ELBOW_NUMBER",name:'弯头编号'},
		{id:"INSP_NUMBER",name:'弯头检测编号'},
		{id:"REFERENCE",name:'最近参考点'},
		{id:"DIRECTION",name:'弯头方向'},
		{id:"REFERENCE_DISTANCE",name:'相对最近参考点距离(m)'},
		//{id:"DETECTION_DATE",name:'检测日期'},
		{id:"ELBOW_TYPE",name:'弯头类别'},
		{id:"ELBOW_ANGLE",name:'弯头角度（°）'},
		{id:"ELBOW_CURVRAD",name:'曲率半径（D）'},
		{id:"SBCNAME",name:'检测器类型'},
		{id:"DETECTION_DATE",name:'发球日期'},
		{id:"DETECTION_TYPE",name:'检测类型'},
		{id:"SENSOR_TYPE",name:'传感器类型'},
		{id:"WALLTHICKNESS",name:'壁厚'},
		{id:"INSP_LENGTH",name:'管件长度'},
		{id:"UGW_NUMBER",name:'上游环焊缝编号'},
		{id:"RECORD_TIME",name:'记录时间'},
		{id:"RECRDER",name:'记录人'},
		{id:"CREATE_REMARK",name:'备注'}
	],

	[{id:"PPLNAME",name:'管道名称',className:'nname',headstyle:'width:16.6%'},/*阀门*/
		//{id:"PPSNAME",name:'管段名称',className:'nname ',headstyle:'width:14.28%'},
		{id:"INSP_NUMBER",name:'阀门检测编号',className:'nname',headstyle:'width:16.6%' },
		{id:"MILEAGE",name:'绝对距离(m)',className:'nname ',headstyle:'width:16.6%'},
		{id:"REF",name:'最近参考点',className:'nname ',headstyle:'width:16.6%'},
		{id:"REFERENCE_DISTANCE",name:'相对最近参考点距离(m)',className:'nname ',headstyle:'width:17.6%'},
		{id:'1',name:'详情',className:'xq-icon2',headstyle:'width:15.6%'},
		{id:"PPLNAME",name:'管道名称',className:'nname'},
		//{id:"PPSNAME",name:'管段名称',className:'nname'},
		{id:"INSP_NUMBER",name:'阀门检测编号'},
		{id:"MILEAGE",name:'绝对距离(m)'},
		{id:"REF",name:'最近参考点'},
		{id:"REFERENCE_DISTANCE",name:'相对最近参考点距离(m)'},
		//{id:"DETECTION_DATE",name:'检测日期'},
		{id:"SBCNAME",name:'检测器类型'},
		{id:"VALVA_NUMBER",name:'阀门编号'},
		{id:"DETECTION_DATE",name:'发球日期'},
		{id:"DETECTION_TYPE",name:'检测类型'},
		{id:"SENSOR_TYPE",name:'传感器类型'},
		{id:"INSP_LENGTH",name:'管件长度'},
		{id:"UGW_NUMBER",name:'上游环焊缝编号'},
		{id:"RECORD_TIME",name:'检测日期'},
		{id:"RECRDER",name:'记录人'},
		{id:"CREATE_REMARK",name:'备注'}
	],

	[{id:"PPLNAME",name:'管道名称',className:'nname',headstyle:'width:14.28%'}, /*环焊缝*/
		//{id:"PPSNAME",name:'管段名称',className:'nname'},
		{id:"GW_NUMBER",name:'环焊缝检测编号',headstyle:'width:14.28%'},
		{id:"GWW_NUMBER",name:'环焊缝焊接编号',headstyle:'width:14.28%'},
		{id:"MILEAGE",name:'绝对距离(m)',headstyle:'width:14.28%'},
		{id:"REF",name:'最近参考点',headstyle:'width:14.28%'},
		{id:"REFERENCE_DISTANCE",name:'相对最近参考点距离(m)',headstyle:'width:15.28%'},
		{id:'1',name:'详情',className:'xq-icon2',headstyle:'width:13.28%'},
		{id:"PPLNAME",name:'管道名称',className:'nname'},
		//{id:"PPSNAME",name:'管段名称',className:'nname'},
		{id:"GW_NUMBER",name:'环焊缝检测编号'},
		{id:"GWW_NUMBER",name:'环焊缝焊接编号'},
		{id:"MILEAGE",name:'绝对距离(m)'},
		{id:"REF",name:'最近参考点'},
		{id:"REFERENCE_DISTANCE",name:'相对最近参考点距离(m)'},
		//{id:"DETECTION_DATE",name:'检测日期'},
		{id:"SBCNAME",name:'检测器类型'},
		//{id:"GWW_NUMBER",name:'环焊缝焊接编号'},
		{id:"DETECTION_DATE",name:'发球日期'},
		{id:"DETECTION_TYPE",name:'检测类型'},
		{id:"SENSOR_TYPE",name:'传感器类型'},
		{id:"WALLTHICKNESS",name:'管节壁厚（mm）'},
		{id:"INSP_LENGTH",name:'管节长度（m）'},
		{id:"FROM_CROSS_CLOCK",name:'上游交点时钟'},
		{id:"TO_CROSS_CLOCK",name:'下游交点时钟'},
		{id:"RECRDER",name:'记录人'},
		{id:"RECORD_TIME",name:'记录时间'},
		{id:"CREATE_REMARK",name:'备注'}
	],

	[{id:"PPLNAME",name:'管道名称',className:'nname',headstyle:'width:14.28%'}, /*三通*/
		//{id:"PPSNAME",name:'管段名称',className:'nname'},
		{id:"INSP_NUMBER",name:'三通检测编号',headstyle:'width:14.28%'},
		{id:"FEATURE_NUMBER",name:'三通编号',headstyle:'width:14.28%'},
		{id:"MILEAGE",name:'绝对距离(m)',headstyle:'width:14.28%'},
		{id:"REF",name:'最近参考点',headstyle:'width:14.28%'},
		{id:"REFERENCE_DISTANCE",name:'相对最近参考点距离(m)',headstyle:'width:15.28%'},
		{id:'1',name:'详情',className:'xq-icon2',headstyle:'width:13.28%'},
		{id:"PPLNAME",name:'管道名称',className:'nname'},
		//{id:"PPSNAME",name:'管段名称',className:'nname'},
		{id:"INSP_NUMBER",name:'三通检测编号'},
		{id:"FEATURE_NUMBER",name:'三通编号'},
		{id:"REF",name:'最近参考点'},
		{id:"REFERENCE_DISTANCE",name:'相对最近参考点距离(m)'},
		{id:"MILEAGE",name:'绝对距离(m)'},
		{id:"SBCNAME",name:'检测器类型'},
		{id:"REF",name:'最近参考点'},
		{id:"DETECTION_DATE",name:'发球日期'},
		{id:"DETECTION_TYPE",name:'检测类型'},
		{id:"SENSOR_TYPE",name:'传感器类型'},
		{id:"INSP_LENGTH",name:'管件长度'},
		{id:"TAP_SIZE",name:'开孔尺寸'},
		{id:"UGW_NUMBER",name:'上游环焊缝编号'},
		{id:"RECRDER",name:'记录人'},
		{id:"RECORD_TIME",name:'记录时间'},
		{id:"CREATE_REMARK",name:'备注'}
	],

	//[{id:"PPLNAME",name:'管道名称',className:'nname'}, /*绝缘接头*/
	// {id:"PPSNAME",name:'管段名称',className:'nname'},
	// {id:"INSP_NUMBER",name:'绝缘接头检测编号'},
	// {id:"CP_INSULATEDJOINT_ID",name:'绝缘接头编号'},
	// {id:"MILEAGE",name:'绝对距离(m)'},
	// {id:"REF",name:'最近参考点'},
	// {id:"REFERENCE_DISTANCE",name:'相对参考点距离(m)'},
	// {id:'1',name:'详情',className:'xq-icon2'},
	// {id:"PPLNAME",name:'管道名称',className:'nname'},
	// {id:"PPSNAME",name:'管段名称',className:'nname'},
	// {id:"DETECTION_DATE",name:'检测时间'},
	// {id:"SBCNAME",name:'检测器类型'},
	// {id:"INSP_NUMBER",name:'绝缘接头检测编号'},
	// {id:"CP_INSULATEDJOINT_ID",name:'绝缘接头编号'},
	// {id:"RECRDER",name:'记录人'},
	// {id:"RECORD_TIME",name:'记录时间'},
	// {id:"CREATE_REMARK",name:'备注'}
	// ],

	[{id:"PPLNAME",name:'管道名称',className:'nname',headstyle:'width:16.6%'},  /*外部支撑*/
		//{id:"PPSNAME",name:'管段名称',className:'nname',headstyle:'width:14.28%'},
		//{id:"INSP_NUMBER",name:'外部支撑检测编号'},
		{id:"FEATURE_NUMBER",name:'外部支撑编号',headstyle:'width:16.6%'},
		{id:"MILEAGE",name:'绝对距离(m)',headstyle:'width:16.6%'},
		{id:"REF",name:'最近参考点',headstyle:'width:16.6%'},
		{id:"REFERENCE_DISTANCE",name:'相对最近参考点距离(m)',headstyle:'width:16.6%'},
		{id:'1',name:'详情',className:'xq-icon2',headstyle:'width:16.6%'},
		{id:"PPLNAME",name:'管道名称',className:'nname'},  /*外部支撑*/
		//{id:"PPSNAME",name:'管段名称',className:'nname'},
		//{id:"INSP_NUMBER",name:'外部支撑检测编号'},
		{id:"FEATURE_NUMBER",name:'外部支撑编号'},
		{id:"MILEAGE",name:'绝对距离(m)'},
		{id:"REF",name:'最近参考点'},
		{id:"REFERENCE_DISTANCE",name:'相对最近参考点距离(m)'},
		//{id:"DETECTION_DATE",name:'检测时间'},
		{id:"SBCNAME",name:'检测器类型'},
		{id:"DETECTION_DATE",name:'发球日期'},
		{id:"DETECTION_TYPE",name:'检测类型'},
		{id:"SENSOR_TYPE",name:'传感器类型'},
		{id:"UGW_NUMBER",name:'上游环焊缝编号'},
		{id:"DISTANCETOUGW_NUMBER",name:'相对上游环焊缝距离(m)'},
		{id:"CLOCK",name:'时钟位置'},
		{id:"RE",name:'记录人'},
		{id:"RECORD_TIME",name:'记录时间'},
		{id:"CREATE_REMARK",name:'备注'}
	],

	[{id:"PPLNAME",name:'管道名称',className:'nname',headstyle:'width:16.6%'},  /*偏心套管*/
		//{id:"PPSNAME",name:'管段名称',className:'nname',headstyle:'width:14.28%'},
		{id:"FEATURE_NUMBER",name:'偏心套管编号',className:'nname',headstyle:'width:16.6%'},
		{id:"FROM_MILEAGE",name:'起点绝对距离(m)',className:'nname ',headstyle:'width:16.6%'},
		{id:"FROM_REFERENCE",name:'起点最近参考点',className:'nname  ',headstyle:'width:16.6%'},
		{id:"FROM_REFERENCE_DISTANCE",name:'起点相对最近参考点距离(m)',className:'nname ',headstyle:'width:17.6%'},
		{id:'1',name:'详情',className:'xq-icon2 ',headstyle:'width:15.6%'},
		{id:"PPLNAME",name:'管道名称',className:'nname'},
		//{id:"PPSNAME",name:'管段名称',className:'nname'},
		{id:"FEATURE_NUMBER",name:'偏心套管编号'},
		{id:"FROM_MILEAGE",name:'起点绝对距离(m)'},
		{id:"FROM_REFERENCE",name:'起点最近参考点'},
		{id:"FROM_REFERENCE_DISTANCE",name:'起点相对最近参考点距离(m)'},
		{id:"TO_MILEAGE",name:'终点绝对距离(m)'},
		{id:"TO_REFERENCE",name:'终点最近参考点'},
		{id:"TO_REFERENCE_DISTANCE",name:'终点相对最近参考点距离(m)'},
		{id:"SBCNAME",name:'检测器类型'},
		{id:"DETECTION_DATE",name:'发球日期'},
		{id:"DETECTION_TYPE",name:'检测类型'},
		{id:"SENSOR_TYPE",name:'传感器类型'},
		{id:"FROM_UGW_NUMBER",name:'起点上游环焊缝编号'},
		{id:"TO_UGW_NUMBER",name:'终点上游环焊缝编号'},
		{id:"FROM_DISTANCETOUGW_NUMBER",name:'起点相对上游环焊缝距离(m)'},
		{id:"TO_DISTANCETOUGW_NUMBER",name:'终点相对上游环焊缝距离(m)'},
		{id:"RE",name:'记录人'},
		{id:"RECORD_TIME",name:'记录时间'},
		{id:"CREATE_REMARK",name:'备注'}
	],

	[{id:"PPLNAME",name:'管道名称',className:'nname',headstyle:'width:16.6%'},   /*金属外接物*/
		//{id:"PPSNAME",name:'管段名称',className:'nname',headstyle:'width:14.28%'},
		{id:"FEATURE_NUMBER",name:'金属外接物编号',className:'nname ',headstyle:'width:16.6%'},
		{id:"MILEAGE",name:'绝对距离(m)',className:'nname',headstyle:'width:16.6%'},
		{id:"REF",name:'最近参考点',className:'nname',headstyle:'width:16.6%'},
		{id:"REFERENCE_DISTANCE",name:'相对最近参考点距离(m)',className:'nname',headstyle:'width:16.6%'},
		{id:'1',name:'详情',className:'xq-icon2',headstyle:'width:16.6%'},
		{id:"PPLNAME",name:'管道名称'},   /*金属外接物*/
		//{id:"PPSNAME",name:'管段名称',headstyle:'width:14.28%'},
		{id:"FEATURE_NUMBER",name:'金属外接物编号'},
		{id:"MILEAGE",name:'绝对距离(m)'},
		{id:"REF",name:'最近参考点'},
		{id:"SBCNAME",name:'检测器类型'},
		{id:"CONTACTIND",name:'是否接触'},
		{id:"CLOCK",name:'时钟位置'},
		{id:"REFERENCE_DISTANCE",name:'相对最近参考点距离(m)'},
		{id:"DETECTION_DATE",name:'发球日期'},
		{id:"DETECTION_TYPE",name:'检测类型'},
		{id:"SENSOR_TYPE",name:'传感器类型'},
		{id:"UGW_NUMBER",name:'上游环焊缝编号'},
		{id:"DISTANCETOUGW_NUMBER",name:'相对上游环焊缝距离(m)'},
		{id:"RE",name:'记录人'},
		{id:"RECORD_TIME",name:'记录时间'},
		{id:"CREATE_REMARK",name:'备注'}
	],

	[{id:"PPLNAME",name:'管道名称',className:'nname',headstyle:'width:16.6%'}, /*修补壳层*/
		//{id:"PPSNAME",name:'管段名称',className:'nname',headstyle:'width:14.28%'},
		{id:"FEATURE_NUMBER",name:'修补壳层编号',className:'nname',headstyle:'width:16.6%'},
		{id:"FROM_MILEAGE",name:'起点绝对距离(m)',className:'nname ',headstyle:'width:16.6%'},
		{id:"FROM_REFERENCE",name:'起点最近参考点',className:'nname',headstyle:'width:16.6%'},
		{id:"FROM_REFERENCE_DISTANCE",name:'起点相对最近参考点距离(m)',className:'nname',headstyle:'width:17.6%'},
		{id:'1',name:'详情',className:'xq-icon2 ',headstyle:'width:15.6%'},
		{id:"PPLNAME",name:'管道名称',className:'nname'}, /*修补壳层*/
		//{id:"PPSNAME",name:'管段名称',className:'nname',headstyle:'nname',headstyle:'width:14.28%'},
		{id:"FEATURE_NUMBER",name:'修补壳层编号'},
		{id:"SBCNAME",name:'检测器类型'},
		{id:"FROM_MILEAGE",name:'起点绝对距离(m)'},
		{id:"FROM_REFERENCE",name:'起点最近参考点'},
		{id:"FROM_REFERENCE_DISTANCE",name:'起点相对最近参考点距离(m)'},
		{id:"TO_MILEAGE",name:'终点绝对距离(m)'},
		{id:"TO_REFERENCE",name:'终点最近参考点'},
		{id:"TO_REFERENCE_DISTANCE",name:'终点相对最近参考点距离(m)'},
		{id:"DETECTION_DATE",name:'发球日期'},
		{id:"DETECTION_TYPE",name:'检测类型'},
		{id:"SENSOR_TYPE",name:'传感器类型'},
		{id:"FROM_UGW_NUMBER",name:'起点上游环焊缝编号'},
		{id:"TO_UGW_NUMBER",name:'终点上游环焊缝编号'},
		{id:"FROM_DISTANCETOUGW_NUMBER",name:'起点相对上游环焊缝距离(m)'},
		{id:"TO_DISTANCETOUGW_NUMBER",name:'终点相对上游环焊缝距离(m)'},
		{id:"RE",name:'记录人'},
		{id:"RECORD_TIME",name:'记录时间'},
		{id:"CREATE_REMARK",name:'备注'}
	],
	[{id:"LINENAME",name:'管道名称',className:'nname',headstyle:'width:12.5%'}, /*其他*/
		{id:"DETECTION_DATE",name:'发球日期',className:'nname',headstyle:'width:12.5%'},
		{id:"FEATURE_NUMBER",name:'特征编号',className:'nname ',headstyle:'width:12.5%'},
		{id:"TYPENAME",name:'特征类型',className:'nname',headstyle:'width:12.5%'},
		{id:"REFERENCE",name:'最近参考点',className:'nname',headstyle:'width:12.5%'},
		{id:"REFERENCE_DISTANCE",name:'相对最近参考点距离',className:'nname',headstyle:'width:12.5%'},
		{id:"CLOCK",name:'时钟位置',className:'nname',headstyle:'width:12.5%'},
		{id:'1',name:'详情',className:'xq-icon2 ',headstyle:'width:12.5%'},
		{id:"LINENAME",name:'管道名称',className:'nname'}, /*其他*/
		{id:"DETECTION_DATE",name:'发球日期'},
		{id:"DETECTION_TYPE",name:'检测类型'},
		{id:"SENSOR_TYPE",name:'传感器类型'},
		{id:"DETECTOR_TYPE",name:'检测器类型'},
		{id:"FEATURE_NUMBER",name:'特征编号'},
		{id:"TYPENAME",name:'特征类型'},
		{id:"MILEAGE",name:'绝对距离(m)'},
		{id:"REFERENCE",name:'最近参考点'},
		{id:"REFERENCE_DISTANCE",name:'相对最近参考点距离(m)'},
		{id:"RAW_UGW_NUMBER",name:'上游环焊缝编号：'},
		{id:"RAW_DISTANCETOUGW_NUMBER",name:'相对上游环焊缝距离(m)'},
		{id:"CLOCK",name:'时钟位置(h:min)'},
		{id:"RECRDER",name:'记录人'},
		{id:"RECORD_TIME",name:'记录时间'},
		{id:"REMARK",name:'备注'}
	]
];
$(function(){
	$(".selectLine a").click(function(){
		resultAjax(getJsPath()+"../comm/taskSegment.json","lineId="+$(this).attr("id"),setTaskSegment,"JSON");
		getSendBall($(this).attr("id"));
	});
	$(".exportExlBtn").click(function(){
		$('.zy-i-input').css({border:"none"});
		$('.zy-i-input').css({height:"35px"});
		var name = exportNames[$(".topMenu li.active").index()];

		var lineName=window.line.val('text');
		var taskName=window.task.val('text');
		name = lineName+taskName+name;
		if(window.total == 0)
		{
			$(this).MSG({
				content: '没有需要导出的记录'
			});
		}else {
			resultAjax(path+"/comm/checkOutTime.json","",function(data,name){
				var exportFile = $(this).EXPT({
					name: name,
					yesBtnAct: function(callback){
						exportExcel(exportFile.name);
						callback();
					}
				});
			},"json",name);

		}

	});


	$(".exportExlBtnLlist").click(function(){
		$('.zy-i-input').css({border:"none"});
		$('.zy-i-input').css({height:"35px"});
		var name ="管道特征总表";
		var lineName=window.line.val('text');
		var taskName=window.task.val('text');
		name = lineName+taskName+name;
		if(window.total == 0)
		{
			$(this).MSG({
				content: '没有需要导出的记录'
			});
		}else {
			resultAjax(path+"/comm/checkOutTime.json","",function(data,name){
				var exportFile = $(this).EXPT({
					name: name,
					yesBtnAct: function(callback){
						exportExcelList(exportFile.name);
						callback();
					}
				});
			},"json",name);

		}

	});



	$(".topMenu li a").attr("href","javascript:;");
	$(".topMenu li").unbind("click").click(function(){

		$(".topMenu li.active").removeClass("active");
		$(this).addClass("active");

		heanData=headdata[$(this).index()];
		currentUrl=path__+$(this).attr("to");
		createHead(heanData,"#dataBox");
		goTo(1,10);
	});

	$("#goTo").unbind("click").click(function(){
		goTo(1,10,true);
	});
//
	var index=$(".topMenu li.active").index();

	heanData=headdata[index];
	currentUrl=getJsPath()+"../"+$(".topMenu li.active").attr("to");
	createHead(heanData,"#dataBox");

	var em=$(".topMenu").parent().find("em");
	if(index== 0)
	{
		em.attr("class","dh-jt");
	}else{
		em.attr("class","dh-jt"+index);
	}

	 $(".xq-icon2").die("click").live('click',function(){
		 $(this).addClass('active');
         var _this=$(this).parent().parent().parent().find("div.show-ul");
          _this.removeClass('none');
         _this.parents('.info-tr').siblings().find('.show-ul').addClass('none');
		 $(this).parent().parent().parent().siblings().find('.xq-icon2').removeClass('active');
     });

     //resultAjax(path+"/comm/newtask.json","",parseNewTask,"JSON");

	bindBall();
});

function exportExcel(fileName)
{

	var param=[];
	var lineId=window.line.val();
	var taskId=window.task.val();
	var beginMileage=window.begin.val('mile');
	var endMileage=window.end.val('mile');


	param.push({"name":"fileName","value":fileName});
	if(typeof(lineId) != "undefined"&& lineId != "")
	{
		param.push({"name":"lineId","value":lineId});
		param.push({name:"lineName",value:window.line.val('text')});
	}

	if(typeof(taskId) != "undefined"&& taskId != "")
	{
		param.push({"name":"taskId","value":taskId});
		param.push({name:"taskName",value:window.task.val('text')});

	}


	if(typeof(beginMileage)!= "undefined"  && beginMileage!='')
	{
		param.push({"name":"beginMileage","value":beginMileage});
		param.push({name:"beginName",value:window.begin.val('text')});

	}
	if(typeof(endMileage)!= "undefined"  && endMileage!='')
	{

		param.push({"name":"endMileage","value":endMileage});
		param.push({name:"endName",value:window.end.val('text')});

	}
	var obj = [window.line,window.task,window.begin,window.end];

	if(checkForm(obj)&&checkFormVerify($("#JQ_form")))
	{
		downFile(path+$(".topMenu li.active").attr("export"),param);
	}
}

function exportExcelList(fileName)
{

	var param=[];
	var lineId=window.line.val();
	var taskId=window.task.val();
	var beginMileage=window.begin.val('mile');
	var endMileage=window.end.val('mile');


	param.push({"name":"fileName","value":fileName});
	if(typeof(lineId) != "undefined"&& lineId != "")
	{
		param.push({"name":"lineId","value":lineId});
		param.push({name:"lineName",value:window.line.val('text')});
	}

	if(typeof(taskId) != "undefined"&& taskId != "")
	{
		param.push({"name":"taskId","value":taskId});
		param.push({name:"taskName",value:window.task.val('text')});

	}


	if(typeof(beginMileage)!= "undefined"  && beginMileage!='')
	{
		param.push({"name":"beginMileage","value":beginMileage});
		param.push({name:"beginName",value:window.begin.val('text')});

	}
	if(typeof(endMileage)!= "undefined"  && endMileage!='')
	{

		param.push({"name":"endMileage","value":endMileage});
		param.push({name:"endName",value:window.end.val('text')});

	}
	var obj = [window.line,window.task,window.begin,window.end];

	if(checkForm(obj)&&checkFormVerify($("#JQ_form")))
	{
		downFile(path+'/insp/gww/exportAll.json',param);
	}
}



function parseNewTask(data){
	if(data.result != undefined)
	{
		if(data.result != undefined)
		{
			data=data.result;
		}
		$("div.dropdown-list[data-name='taskSegmentId']").attr("select",data.SEGMENTID);
		$("div.dropdown-list[data-name='taskId']").attr("select",data.ID);
		$("div.dropdown-list[data-name='lineId']").attr("select",data.LINEID);
		for(var i = 0;i<data.taskSegmentList.length;i++)
		{
			$(".selectSegment").append('<li><a href="javascript:void(0);" id="'+data.taskSegmentList[i].ID+'">'+data.taskSegmentList[i].NAME+'</a></li>');
		}
		for(var i = 0;i<data.taskList.length;i++)
		{
			$(".selectTask").append('<li><a href="javascript:void(0);" id="'+data.taskList[i].ID+'">'+data.taskList[i].NAME+'</a></li>');
		}
		for(var i = 0;i<data.segmentList.length;i++)
		{
			$(".segment").append('<li><a href="javascript:void(0);" id="'+data.segmentList[i].ID+'">'+data.segmentList[i].NAME+'</a></li>');
		}
		//添加检测管段选择事件
		$(".selectSegment li").unbind("click").click(function(){
			//查询检测任务
			resultAjax(path+"/comm/task.json","taskSegmentId="+$(this).find("a").attr("id"),parseTask,"JSON");
			//查询物理管段
			resultAjax(path+"/comm/segment.json","taskSegmentId="+$(this).find("a").attr("id"),setSegment,"JSON");
		});
		paramHandler();
		goTo(1,10);
	}
}

/**
 * 处理进入页面是，预定义选项
 */
function paramHandler(){
	$("div.dropdown-list[data-name]").each(function(){
		var select=$(this).attr("select");
		if(select == "" ){
			return;
		}
		var obj=$(this);
		$(this).find("li a").each(function(){
			if($(this).attr("id")==select){
				obj.find(".checked a").attr("id",select);
				obj.find(".checked a").text($(this).text());
			}
		});
	});
}
/**
 * 请求后台数据
 * @param pageNo
 * @param pageSize
 */
function goTo(pageNo,pageSize,search){


	var data="t=1";//访问后台参数
		data+="&pageNo="+pageNo;//当前页面
		data+="&pageSize="+pageSize;//每页显示条数

	var lineId=window.line.val();
	var taskId=window.task.val();
	var beginMileage=window.begin.val('mile');
	var endMileage=window.end.val('mile');

		if(typeof(lineId) != "undefined"&& lineId != "")
		{
			data+="&lineId="+lineId;
		}
		if(typeof(taskId) != "undefined"&& taskId != "")
		{
			data+="&taskId="+taskId;
		}


		if(typeof(beginMileage)!= "undefined"  && beginMileage!='')
		{
			data+="&beginMileage="+beginMileage;
		}
		if(typeof(endMileage)!= "undefined"  && endMileage!='')
		{
			data+="&endMileage="+endMileage;
		}




	var obj = [window.line,window.task,window.begin,window.end];

	if(checkForm(obj)&&checkFormVerify($("#JQ_form")))
	{
		resultAjax(currentUrl,data,result,"json");
	}


}

/**
 * 创建分页html
 */
function createPageHandler()
{
		var html='';
		html+='<div class="new-paging" style="border:none;border-bottom:1px solid #d7dde9">';
		html+='<span class="sy">本次检索共<i>1000</i>&nbsp;&nbsp; 条,每页显示<i>10&nbsp;&nbsp;</i>&nbsp;&nbsp;条，共&nbsp;<i>&nbsp;&nbsp;</i>&nbsp;&nbsp;&nbsp;页</span>';
		html+='    <div class="ppaing">';
		html+='        <a class="prev-page" href=""><em></em></a>';
		html+='         <a class="" href="">1</a>';
		html+='         <a class="" href="">2</a>';
		html+='         <a class="" href="">……</a>';
		html+='         <a class="" href="">10</a>';
		html+='         <a class="next-page" href=""><em></em><span>下一页</span></a>';
		html+='     </div>';
		html+=' </div>';

		$(".new-p").append(html);
}

/**
 * 生成分页html
 * @param pageNo
 * @param pageSize
 * @param total
 */
function createPageHtml(pageNo,pageSize,total){
	window.total = total;
	$(".new-paging .ppaing").remove();
	$(".new-paging .sy i:eq(0)").text(total);

	if(total == 0){
		$(".new-paging").hide();
		return ;
	}
	$(".new-paging").show();


	var totalPage=total/pageSize;
	var t=(""+totalPage);
		if(t.indexOf(".")>0)
		{
			totalPage=parseInt(t.substring(0, t.indexOf(".")))+1;
		}
	$(".new-paging .sy i:eq(2)").text(totalPage);
	var pageHtml='<p class="ppaing clearFix" pageNo="'+pageNo+'"  total="'+totalPage+'">';
		pageHtml+=   '<button  class="prev-page  '+(pageNo==1?"no-cursor":"prv" )+' ">上一页</button>';
		//pageHtml+=   '<a href="javascript:;" class="go">1</a>';


		if(pageNo >4 && totalPage > 7)
		{
			//pageHtml+=   '<a href="javascript:;" class="goBegin">…</a>';
		}
		if(totalPage<6)
		{
			for(var i = 1;i <= 4 && i<= totalPage;i++)
			{
				pageHtml+=   '<button class="go '+(pageNo==i?"active":"")+'">'+i+'</button>';
			}

		}else{
			var begin=pageNo+3>totalPage?totalPage-3:pageNo>1?pageNo-1:pageNo;
			var end=begin +4 ;
			for(var i=begin; i< end;i++)
			{

					pageHtml+=   '<button   class="go '+(pageNo==i?"active":"")+'">'+i+'</button>';



			}
		}


		if((pageNo+2 < totalPage || pageNo+1 < totalPage ) && totalPage>5)
		{
			//pageHtml+=   '<a href="javascript:;" class="go total">'+totalPage+'</a>';
		}
		pageHtml+=   '<button href="javascript:;" class="next-page next '+(pageNo==totalPage?"no-cursor":"")+'">下一页</button>';
		pageHtml+= '</p>';

		$(".new-paging ").append(pageHtml);


		$(".new-paging .ppaing button").click(function(){
			var pageSize=$(".new-paging .sy i:eq(1)").text();
			var pageNo=1;
			if($(this).hasClass("go")){
				pageNo=parseInt($(this).text());
			}
			else if($(this).hasClass("prv")){
				pageNo=parseInt($(this).parent().attr("pageNo"))-1;
			}
			else if($(this).hasClass("next")){
				pageNo=parseInt($(this).parent().attr("pageNo"))+1;
			}
			else if($(this).hasClass("goBegin")){
				pageNo=1;
			}
			else if($(this).hasClass("goEnd")){
				pageNo=parseInt($(this).parent().attr("total"));
			}
			else if($(this).hasClass("clickGo")){
				pageNo=parseInt($("div.body_data .paging-footer .paging0 .clickGoInput").val());
			}
			var total=parseInt($(this).parent().attr("total"));
			if(pageNo > total )
			{
				pageNo=total;
			}
			if(pageNo<1)
			{
				pageNo=1;
			}
			goTo(pageNo,parseInt(pageSize));
		});



}

/**
 * 后台数据返回
 * @param data
 */
function result(data)
{

	createHead(heanData,"#dataBox");
	var pageNo=data.pageNo;
	var pageSize=data.pageSize;
	var total=data.total;
	data=data.data;
	$imgUrl=$('#imgURL').attr('img_value');

	$(".conts-table").remove();
	parseData(data,heanData,"#dataBox .conts");
	$(".new-paging").remove();
	createPageHandler();
	//创建分页信息
	createPageHtml(pageNo,pageSize,total);
	//无数据
	if(data.length == 0)
	{
		var html="";
		html+='<div class="info-tr" style="text-align:center;height:200px;margin-top:40px">';
		html+='<img  src="'+$imgUrl+'" />';
		html+='</div>';
		$("div.conts-table").append(html);

	}


}

/**
 * 创建列表 head 头部
 *
 * @param head
 * @param context
 */
function createHead(head,context)
{
	$(context).empty();
	var headHtml='<div class="conts">';
		headHtml+='<ul class="one">';
	for(var i=0;i<head.length;i++)
	{


		if(head[i].headclassName) {
			headHtml+='<li class="'+head[i].headclassName+'"    '+(head[i].headstyle!=undefined?"style='"+head[i].headstyle+"'":"")+'>';
		} else {
			headHtml+='<li  '+(head[i].headstyle!=undefined?"style='"+head[i].headstyle+"'":"")+'>';
		}



		headHtml+='<span>'+head[i].name+'</span></li>';


		if(head[i].id == '1')
		{
			break;
		}

	}
	headHtml+='</ul>';
	headHtml+='</div>';
	$(context).append(headHtml);


	parseData([],head,context);
	//createPageHtml(0,0,0);
	$imgUrl=$('#imgURL').attr('img_value');
	var html ='';
	html+='<div class="info-tr" style="text-align:center;height:200px;margin-top:40px">';
	html+='<img  src="'+$imgUrl+'" />';
	html+='</div>';

	$("div.conts-table").append(html);
}
/**
 * 解析data 生成列表数据
 * @param data
 * @param head
 * @param context
 */
function parseData(data,head,context)
{




	var html='<div class="conts-table">';

	for(var i=0;i<data.length;i++)
	{
		html+='<div class="info-tr">';

		html+='<ul  class="ul-header bg-white '+(i%2==1?'bg-second Ellipse-deformation':'')+'">';
		//ul-header
		var isRow=true;
		for(var j=0;j<head.length;j++)
		{
			if(isRow)
			{


                if(head[j].id == "1")
                {
					html+='<li  '+(head[j].headstyle!=undefined?"style='"+head[j].headstyle+"'":"")+' >';
                    html+="<span class='xq-icon2 '></span>";
                    //"</li>"
                }else{
					html+='<li '+(head[j].headstyle != undefined?"style='"+head[j].headstyle+"'":"")+' class="'+head[j].className+'" title="'+getVal(data[i],head[j].id)+'">';
                    html+=getVal(data[i],head[j].id);
                }
                html+="</li>";
				if(head[j].id == "1")
				{
					isRow=false;
					html+="</ul>";
					html+='<div class="show-ul none">';
					html+='<ul class="show-list">';
				}
			}else{

				html+='<li ><span class="s1">'+head[j].name+' : </span><span class="s2" title="'+getVal(data[i],head[j].id)+'">'+getVal(data[i],head[j].id)+"</span></li>";
			}

		}
		html+="</ul>";
		if(!isRow)
		{
			html+="<div class='zy-xyf-footer' style='position:relative;width:100%;text-align:right;margin-bottom:15px'><button  type='button' class='zy-button xyf-retract lsk-re'><i></i>收起</button></div></div>";

		}
		html+="</div>";

	}

	html+="</div>";
	$(context).append(html);


}
$('.lsk-re').live('click',function(){
    $(this).parent().parent().addClass('none');
	$(this).parent().parent().parent().find('ul').find('li').find('.xq-icon2').removeClass('active');
});


function getVal(data,name)
{

	if(name == "XYZHL")
	{//(B/L/X/Y/Z)

		return data["RAW_B"]+"/"+data["RAW_L"]+"/"+data["RAW_H"]+"/"+data["RAW_X"]+"/"+data["RAW_Y"]+"/"+data["RAW_Z"];
	}
	var val=data[name];
	if(val == "-")
	{
		return val;
	}
	if(name == "MILEAGE" || name == "REFERENCE_DISTANCE" || name == "FROM_MILEAGE"  || name == "TO_MILEAGE"
		|| name == "FROM_REFERENCE_DISTANCE"  || name == "TO_REFERENCE_DISTANCE" )
	{
		val=parseFloat(parseFloat(val).toFixed(3));
	}
	if(name == "RECORDTIME" || name == "RECORD_TIME" || name == "DETECTION_DATE"||name == "DETECTION_DATE")
	{
		val = val.substring(0,10);
	}

	return val==""?"-":val;
}
